package com.aaa.java09;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2022/7/12 15:50
 * @description：主人类
 * @modified By：
 * @version: 1.0
 */
public class Master {
    private int id;


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

   /* public  void feed(Dog dog){
        System.out.println("喂养宠物");
    }
    public  void feed(Cat cat){
        System.out.println("喂养宠物");
    }*/

    public void feed(MyPet pet) {
        System.out.println("喂养宠物");
        pet.playWithOwner();
        pet.eat();
    }

    public static void main(String[] args) {
        MyPet dog = new Dog("旺财1", 12, "白色", "中华财犬");
        MyPet cat = new Cat("tom", 12, "白色", 20);
        Master master = new Master();
        master.setId(290);

        MyPet pet1 = dog;
        MyPet pet2 = cat;


        master.feed(pet1);

        master.feed(pet2);

    }
}
